#include "TCPSertest.h"

int main()
{	
	try
	{
		io_context iose;
		ip::tcp::endpoint ep(ip::tcp::v4(), 8888);
		ip::tcp::acceptor acceptor(iose, ep);
		for (;;)
		{
			auto clientSocket = acceptor.accept(ep);
			std::cout <<  clientSocket.remote_endpoint().address() << std::endl;
			boost::system::error_code ec;
			for (;;)
			{
				TCPServer s;
				std::cout << s.read(clientSocket) << std::endl;
				if (ec == boost::asio::error::eof)
				{
					break;
				}
				else if (ec) {
					std::cout << boost::system::error_code(ec).what() << std::endl;
				}
			}
		}
	}
	catch (const std::exception& e)
	{
		std::cout << e.what() << std::endl;
	}
	return 0;
}